﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MP3ToAudioBookWithChapters.Library.Properties;

namespace MP3ToAudioBookWithChapters.Library
{
    public class Mp3Helper
    {
        public static void Append(string destinationFile, string sourceFile)
        {
            using (var destinationStream = File.Open(destinationFile, File.Exists(destinationFile) ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.None))
            using (var sourceStream = File.Open(sourceFile, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                int count;
                byte[] buffer = new byte[2048];
                while ((count = sourceStream.Read(buffer, 0, buffer.Length)) > 0)
                    destinationStream.Write(buffer, 0, count);
            }
        }

    }
}
